package quick.start.core.postq;

import java.io.Serializable;
import java.util.HashMap;

import quick.start.core.connect.Verbs;

public class CommonRequest implements Serializable {
	
	private static final long serialVersionUID = 6809046119809725689L;
	private Verbs verb;
	private String methodName;
	private HashMap<String, String> params;
	
	public CommonRequest(Verbs verb, String method, HashMap<String, String> params){
		this.verb = verb;
		this.methodName = method;
		this.params = params;
	}

	public Verbs getVerb() {
		return verb;
	}

	public String getMethodName() {
		return methodName;
	}

	public HashMap<String, String> getParams() {
		return params;
	}

	@Override
	public boolean equals(Object o) {
		if(this == o)
			return true;
		if(o == null || getClass() != o.getClass())
			return false;
		
		CommonRequest that = (CommonRequest)o;
		if(this.methodName.equals(that.methodName))
			return false;
		if(this.params != null ? !this.params.equals(that.params) : that.params != null)
			return false;
		if(this.verb != that.verb)
			return false;
		return true;
	}

	@Override
	public int hashCode() {
        int result = this.verb.hashCode();
        result = 31 * result + this.methodName.hashCode();
        result = 31 * result + (this.params != null ? this.params.hashCode() : 0);
        return result;
	}
}
